<script setup lang="ts">
import { ref, onMounted, nextTick } from "vue";
import { privacyNotes } from "@/api/user";
import { onLoad } from "@dcloudio/uni-app";

const privacy = ref("");

onLoad(async (options: any) => {
  if (options?.type) {
    privacyNotes(options.type).then(res => {
      privacy.value = res.data.data;
    });
    console.log(" options.type", options.type);
    await nextTick();
    uni.setNavigationBarTitle({
      title: options.type === "2" ? "隐私条款" : "用户协议"
    });
  } else {
    uni.navigateTo({
      url: "/pages/login/login"
    });
  }
});
</script>

<template>
  <view class="text">
    <text>
      {{ privacy }}
    </text>
  </view>
</template>

<style lang="scss" scoped>
.text {
  padding: 16px;
  overflow-y: scroll;
}
</style>
